package com.csc.bankingsystem.core.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.csc.bankingsystem.core.enumeration.AccountInfoStateEnum;
import com.csc.bankingsystem.core.enumeration.AccountInfoTypeEnum;
import com.fasterxml.jackson.annotation.JsonManagedReference;

/**
 * AccountInfo Data Transfer Object
 * 
 * @author angelkid
 *
 */
@Entity
@Table(name = "ACCOUNTINFO")
public class AccountInfo extends BankingSystemAbstractEntity {
	private String number;
	private String idCardNumber;
	private String firstName;
	private String lastName;
	private String midName;
	private String phoneNumber1;
	private String phoneNumber2;
	private String address1;
	private String address2;
	private String email1;
	private String email2;
	private Long amount;
	private AccountInfoTypeEnum accountType;
	private AccountInfoStateEnum state;
	private UserInfo userInfo;
	
	@Column(name = "number", unique = true, nullable = true, length = 12)
	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	@Column(name = "idCardnumber", unique = true, nullable = true, length = 12)
	public String getIdCardNumber() {
		return idCardNumber;
	}

	public void setIdCardNumber(String idCardNumber) {
		this.idCardNumber = idCardNumber;
	}

	@Column(name = "firstname", unique = false, nullable = true, length = 50)
	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	@Column(name = "lastname", unique = false, nullable = true, length = 50)
	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	@Column(name = "midname", unique = false, nullable = true, length = 50)
	public String getMidName() {
		return midName;
	}

	public void setMidName(String midName) {
		this.midName = midName;
	}

	@Column(name = "phonenumber1", unique = false, nullable = true, length = 50)
	public String getPhoneNumber1() {
		return phoneNumber1;
	}

	public void setPhoneNumber1(String phoneNumber1) {
		this.phoneNumber1 = phoneNumber1;
	}

	@Column(name = "phonenumber2", unique = false, nullable = true, length = 50)
	public String getPhoneNumber2() {
		return phoneNumber2;
	}

	public void setPhoneNumber2(String phoneNumber2) {
		this.phoneNumber2 = phoneNumber2;
	}

	@Column(name = "address1", unique = false, nullable = true, length = 50)
	public String getAddress1() {
		return address1;
	}

	public void setAddress1(String address1) {
		this.address1 = address1;
	}

	@Column(name = "address2", unique = false, nullable = true, length = 50)
	public String getAddress2() {
		return address2;
	}

	public void setAddress2(String address2) {
		this.address2 = address2;
	}

	@Column(name = "email1", unique = false, nullable = true, length = 50)
	public String getEmail1() {
		return email1;
	}

	public void setEmail1(String email1) {
		this.email1 = email1;
	}

	@Column(name = "amount", nullable = true, length = 50)
	public Long getAmount() {
		return amount;
	}
	
	public void setAmount(Long amount) {
		this.amount = amount;
	}
	
	@Column(name = "email2", unique = false, nullable = true, length = 50)
	public String getEmail2() {
		return email2;
	}

	public void setEmail2(String email2) {
		this.email2 = email2;
	}

	@Column(name = "accountType",unique = false, nullable = true)
	@Enumerated(EnumType.STRING)
	public AccountInfoTypeEnum getAccountType() {
		return accountType;
	}

	public void setAccountType(AccountInfoTypeEnum accountType) {
		this.accountType = accountType;
	}

	@Column(name = "state",unique = false, nullable = true)
	@Enumerated(EnumType.STRING)
	public AccountInfoStateEnum getState() {
		return state;
	}

	public void setState(AccountInfoStateEnum state) {
		this.state = state;
	}

	@JsonManagedReference
	@ManyToOne
	@JoinColumn(name = "userInfoId")
	public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	@Override
	public String toString() {
		return "AccountInfo [number=" + number + ", idCardNumber="
				+ idCardNumber + ", firstName=" + firstName + ", lastName="
				+ lastName + ", midName=" + midName + ", phoneNumber1="
				+ phoneNumber1 + ", phoneNumber2=" + phoneNumber2
				+ ", address1=" + address1 + ", address2=" + address2
				+ ", email1=" + email1 + ", email2=" + email2 + ", amount="
				+ amount + "]";
	}
}
